<template>
	<view class="Main">

		<view class="TopDiv" v-if="IsRuKu==false">
			<view class="JiChuDiv">
				基础信息
			</view>
			<view class="Xian"></view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					活动名称：
				</view>
				<view class="ItemDesc">
					test2
				</view>
			</view>

			<view class="ItemDiv">
				<view class="ItemTitle">
					活动名称：
				</view>
				<view class="ItemDesc">
					test2
				</view>
			</view>

			<view class="ItemDiv">
				<view class="ItemTitle">
					周期活动：
				</view>
				<view class="ItemDesc">
					关闭
				</view>
			</view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					活动渠道：
				</view>
				<view class="ItemDesc">
					关闭
				</view>
			</view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					活动门店：
				</view>
				<view class="ItemDesc">
					关闭
				</view>
			</view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					适用对象：
				</view>
				<view class="ItemDesc">
					关闭
				</view>
			</view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					会员积分：
				</view>
				<view class="ItemDesc">
					关闭
				</view>
			</view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					共享优惠：
				</view>
				<view class="ItemDesc">
					关闭
				</view>
			</view>
		</view>
		<view class="TopDiv" v-else>
			<view class="JiChuDiv">
				基础信息
			</view>
			<view class="Xian"></view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					入库单编号：
				</view>
				<view class="ItemDesc">
					{{ItemDesc.id}}
				</view>
			</view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					门店名：
				</view>
				<view class="ItemDesc">
					{{ItemDesc.storeName}}
				</view>
			</view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					创建人：
				</view>
				<view class="ItemDesc">
					{{ItemDesc.createBy}}
				</view>
			</view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					创建时间：
				</view>
				<view class="ItemDesc">
					{{ItemDesc.createTime}}
				</view>
			</view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					总零售价：
				</view>
				<view class="ItemDesc">
					{{ItemDesc.salePrice}}
				</view>
			</view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					总入货价：
				</view>
				<view class="ItemDesc">
					{{ItemDesc.totalCostPrice}}
				</view>
			</view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					总利润：
				</view>
				<view class="ItemDesc">
					{{Number(ItemDesc.salePrice) - Number(ItemDesc.totalCostPrice)}}
				</view>
			</view>
			<view class="ItemDiv">
				<view class="ItemTitle">
					备注：
				</view>
				<view class="ItemDesc">
					{{ItemDesc.remark}}
				</view>
			</view>

		</view>

		<view class="SecondDiv" v-for="item in ShoppingList" :key="item.id">

			<view class="JiChuDiv">
				商品信息
			</view>
			<view class="Xian"></view>
			<view class="ShanPingItem">
				<view class="ShanPingTop">
					<view class="ShangPingLeft">
						<image src="/static/icons/NoPhoto.jpg" mode="" v-if="item.image_url==null"></image>
						<image :src="item.image_url" mode="" v-else></image>
					</view>
					<view class="ShangPingRight">
						<view class="ShangPingText">
							{{item.name}}
						</view>
						<view class="ShangPingText">
							条码：{{item.barcode}}
						</view>
						<view class="ShangPingText">
							毛重：{{item.gross_weight}}
						</view>
						<view class="ShangPingText">
							零售价：
							<view class="ShangPingMoney">
								￥{{ item.salePrice }}
							</view>
						</view>
					</view>
				</view>
				<view class="ShanPingBottom">
					<view class="ItemDiv XianGou">
						<view class="ItemTitle">
							数量：{{item.number}}
						</view>
						<view class="ItemDesc">
							入货价：<view class="ShangPingMoney">
								￥{{item.costPrice}}
							</view>
						</view>
					</view>
				</view>
			</view>

		</view>
	
		<view class="OutLogin" v-if="IsRuKu==false">
			<button type="default" class="CanCelButton" @click="PiLiangButton" style="margin-left: 2vw;">删除</button>
			<button type="default" class="CanCelButton" @click="NextBuZhou">停用</button>
			<button type="default" class="OutLoginButton1" @click="NextBuZhou" style="margin-right: 2vw;">编辑</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				IsRuKu:false,
				ItemDesc:{},
				ShoppingList:[],

			}
		},
		mounted() {
			// this.queryGoodsByBarcode("test2(该字段不能重复)")
		},

		onLoad(option) {
			if(option.type=="RuKu"){
				this.IsRuKu = true
				uni.showLoading({
					title: '加载中'
				});
				let url = this.$api.businessgoods+'/'+option.id
				this.$request(url, null, "GET", false).then(res => {
					uni.hideLoading();
					if (res.code == '0') {
						this.ItemDesc = res.data.desc
						this.ShoppingList = res.data.data
						JSON.parse(uni.getStorageSync("MenDianList")).forEach(item=>{
							if(item.id==this.ItemDesc.storeId){
								this.ItemDesc.storeName=item.name
							}
						})

					} else {
						uni.showToast({
							title: "错误",
							icon: 'error'
						});
					}
				})
			}

		},
		methods: {

		}
	}
</script>

<style>
	.OutLoginButton1 {
		height: 76rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		flex: 1;
		color: rgba(255, 255, 255, 1) !important;
		background-color: #007afc !important;
		border-radius: 0 !important;
		font-size: 0.9rem;
		text-align: center;
	
	}
	.CanCelButton {
		height: 76rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		flex: 1;
		border: 2rpx solid #1d77c2;
		color: #1d77c2 !important;
		border-radius: 0 !important;
		background-color: white !important;
		font-size: 0.9rem;
		text-align: center;
	}
	.OutLogin {
		width: 100%;
		position: fixed;
		bottom: 0;
		display: flex;
		justify-content: center;
		align-items: center;
		align-content: center;
		padding-top: 18rpx;
		padding-bottom: 38rpx;
		background: white;
		gap: 2vw;
		/* left: 2vw; */
	}
	.XianGou {
		height: 91rpx !important;
		margin-bottom: -20rpx;
	}

	.ShanPingTop {
		display: flex;
		align-items: center;
		gap: 25rpx;
		padding-bottom: 20rpx;
		border-bottom: 2rpx solid #e6e6e6;
	}

	.ShangPingMoney {
		color: red;
	}

	.ItemDesc {
		display: flex;
		align-items: center;
	}

	.ShangPingText {
		font-size: 28rpx;
		display: flex;
		height: 53rpx;
		align-items: center;
	}

	.ShanPingItem {
		display: flex;
		flex-direction: column;
		padding-top: 10rpx;
	}

	.ShangPingLeft image {
		width: 200rpx;
		height: 200rpx;
	}

	.ItemDiv {
		display: flex;
		justify-content: space-between;
		font-size: 28rpx;
		height: 65rpx;
		align-items: center;
	}

	.Main {
		min-height: 100vh;
		background: #f2f3f5;
		    padding-bottom: 113rpx;
	}

	.SecondDiv {
		padding: 10rpx 27rpx;
		background: white;
		padding-bottom: 20rpx;
		border-radius: 20rpx;
		margin-bottom: 23rpx;
	}

	.TopDiv {
		padding: 10rpx 27rpx;
		background: white;
		padding-bottom: 20rpx;
		border-bottom-right-radius: 20rpx;
		border-bottom-left-radius: 20rpx;
		margin-bottom: 23rpx;
	}

	.JiChuDiv {
		height: 80rpx;
		display: flex;
		align-items: center;
		font-size: 32rpx;
	}

	.Xian {
		height: 2rpx;
		width: 100vw;
		border-bottom: 2rpx solid #e6e6e6;
		margin: 0 -20rpx;
		margin-bottom: 19rpx;
		margin-top: 11rpx;
	}
</style>
